<?php 
$params = Yii::app()->controller->getActionParams();
if (!empty($params)) {
    foreach($params as $key => $value) {
        if ($key == 'lang')
            $langParam = $value;
    }
}
?>

<?php
    if(count($sanPham)>0)
    {
        $tongtien = 0;
        foreach($sanPham as $sp )
        {
            ?>
        <form action="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=cart/UpdateCart&maSp=<?php echo $sp->IDSP?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>" method="post">
            <table width="100%" border="1" class="cart_box" id="text_cart_box">

            <tr>
                <td width="31%" rowspan="3"><img class="imgcart" src="<?php echo Yii::app()->request->baseUrl; echo"/images/products/";?><?php echo $sp->HINHANH ?> " width="50" height="50"></td>
                <td colspan="3" bgcolor="#00bfff" id="name_cart_box">
                    <div align="center"><?php echo $sp->TENSP;?> </div>
                </td>
            </tr>
            <tr >
                <td width="19%" align="center"  ><?php echo Yii::t('translation', 'Amount') ?> :</td>
                <td  width="26%" align="center"><input type=text name="SoLuong" size=5 value="<?php echo $sp->getQuantity(); ?>">
                    <td width="24%" align="center"><input type="submit" name=submit value="<?php echo Yii::t('translation', 'Update') ?>"></td>
                </td>
                <!--<td width="24%" align="center"><input type="submit" name=submit value="Cập Nhật"></td>-->
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <?php echo Yii::t('translation', 'Price') ?>:<?php echo "<br>".number_format($sp->GIATIEN) ?> VNĐ
                    <br/> <br/>
                    <?php echo Yii::t('translation', 'TotalForProduct') ?><?php echo "<br>".number_format($sp->getQuantity()*$sp->GIATIEN) ?> VNĐ
                </td>
                <td align="center">
                    <h3><a href="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=cart/RemoveCart&maSp=<?php echo $sp->IDSP?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>"><?php echo Yii::t('translation', 'Delete') ?></a></h3>
                </td>
            </tr>
        </table>
        </form>

            <?php
            $tongtien+=$sp->getQuantity()*$sp->GIATIEN;
        }
        echo Yii::t('translation', 'TotalForPayment').number_format($tongtien).' (VNĐ) </h1>';
    }
    else
    {
        echo Yii::t('translation', 'NoProductInCart');
    }
?>
    <table width="100%" border="2">
        <tr style="color:#ff00ff; text-align: center;" >
            <td ><h3><a href="./index.php?<?php if (!empty($langParam)) echo "lang=".$langParam; ?>"> <?php echo Yii::t('translation', 'ContinueToBuy') ?></a></h3></td>
            <?php
                if(count($sanPham)>0)
                {
                    ?>
                    <td ><h3><a href="?r=cart/payment<?php if (!empty($langParam)) echo "&lang=".$langParam; ?>"> <?php echo Yii::t('translation', 'Payment') ?></a></h3></td>
                    <?php
                }
            ?>

        </tr>
    </table>